<template>
  <view class="flex flex-column flex-center padding-0-30">
    <view class="flex flex-center">
      <image style="width: 400rpx; height: 400rpx" :src="httpurl + '/static/uniapp/img/ht.png'" mode=""></image>
    </view>
    <view class="color-tips">为保障您的合法权益，请签署承诺书</view>
    <u-gap height="20rpx"></u-gap>
    <view class="color-b9 font30">为有效保障您的合法权益和浙收卡正常合法经营需实名认证并签署承诺书，才能使用浙收卡回收服务及提现操作，请您仔细阅读并签署!</view>
    <view class="padding info-box">
      <view class="color-b3 font26">
        真实姓名：
        <text class="font32">{{ userInfo['userReal']['name'] }}</text>
      </view>
      <u-gap height="20rpx"></u-gap>
      <view class="color-b3 font26">
        身份证号：
        <text class="font32">{{ userInfo['userReal']['idcard'] }}</text>
      </view>
    </view>
    <view @click="sign" class="flex flex-center btn-sign font28 color-w">立即去签署</view>
    <!--    <view v-if="signUrl" class="url-box" style="text-align: center">
      <view>复制签署地址使用浏览器打开：</view>
      <view class="url">
        <text>{{ signUrl }}</text>
      </view>
      <view @click="copyUrl">
        <button class="cu-btn bg-red margin-tb-sm lg">复制</button>
      </view>
    </view> -->
  </view>
</template>
<script>
export default {
  data() {
    return {
      userInfo: JSON.parse(uni.getStorageSync('users')),
      signUrl: '',
      qrCode: '',
      httpurl: '' //图片链接
    };
  },
  onLoad() {
    console.log(this.userInfo);
  },
  onShow() {
    this.httpurl = this.app.httpUrl;
  },
  methods: {
    copyUrl() {
      uni.setClipboardData({
        data: this.signUrl,
        success: () => {
          uni.showToast({
            title: '复制成功',
            icon: 'none'
          });
        },
        fail: (err) => {}
      });
      // #ifdef MP-ALIPAY
      my.setClipboard({
        text: this.signUrl
      });
      // #endif
    },
    sign() {
      var that = this;
      uni.request({
        url: that.app.apiHost + '/qian',
        method: 'POST',
        header: { Authorization: 'bearer ' + that.app.getAuthCode() },
        success: (res) => {
          this.qrCode = res.data.data.qrCode;
          this.signUrl = res.data.data.url;
          uni.navigateTo({
            url: `/pages/common/webgzh?url=${encodeURIComponent(res.data.data.url)}`
          });
          console.log('000000', this.signUrl);
        },
        fail(res) {}
      });
    }
  }
};
</script>

<style lang="scss">
.color-tips {
  font-size: 40rpx;
  font-weight: 500;
  color: rgb(236, 140, 64);
}
.info-box {
  margin-top: 40rpx;
  padding: 30rpx;
  border-radius: 20rpx;
  border: 1px dotted #20d071;
}
.btn-sign {
  padding: 20rpx 80rpx;
  border-radius: 40rpx;
  margin-top: 40rpx;
  background-color: #20d071;
}
</style>
